<?php
	namespace Common\Logic;
	use Common\Model\SystemPicModel;
	class SystemPicLogic extends SystemPicModel{
		/*
		* Function:		getSystemPicList
		* Description:	操作记录列表
		* @param:		$page string 起始页
						$filter array 过滤数组
						$pageSize string 每页显示条数
		*/
		public function getSystemPicList($page=1,$filter = '',$pageSize=20){
			$conditon = $this->getSystemPicFilter($filter);
			return $this->where($conditon)->order('id desc')->limit(($page-1)*$pageSize,$pageSize)->select();
		}
		
		/*
		* Function:get:	getSystemPicFilter
		* Description:	操作记录列表搜索过滤项
		* @param:		$filter array 过滤数组
		*/
		public function getSystemPicFilter($filter = ''){
			$conditon = array();
			if(!empty($filter['name'])){
				$conditon['title'] = $filter['name'];
			}
			if(!empty($filter['type'])){
				$conditon['type'] = $filter['type'];
			}
			return $conditon;
		}
		
		/*
		* Function:get:	getSystemPicCount
		* Description:	操作记录列表总数
		* @param:		$filter array 过滤数组
		*/
		public function getSystemPicCount($filter = ''){
			$conditon = $this->getSystemPicFilter($filter);
			return $this->where($conditon)->count();
		}
		
		/*
		* Function:		addSystemPic
		* Description:	增加操作记录
		* @param:		$data array 增加的数组
		*/
		public function addSystemPic($data){
			return $this->add($data);
		}
		
		/*
		* Function:		getSystemPicInfo
		* Description:	获取操作记录信息 by row
		* @param:		$id int ID
		*/
		public function getSystemPicInfo($id){
			return $this->where(array('id'=>$id))->find();
		}
		
		/*
		* Function:		updateSystemPic
		* Description:	更新操作记录
		* @param:		$data array 更新的数组
		*/
		public function updateSystemPic($data){
			return $this->save($data);
		}
		
		/*
		* Function:		deleteSystemPic
		* Description:	删除操作记录
		* @param:		$id int ID
		*/
		public function deleteSystemPic($id){
			return $this->where(array('id'=>$id))->delete();
		}
	}
?>